<?php

class DB_Queue extends DB_CRUD {
    protected $table = 'msg_queue';
    protected $PK = 'id';
    protected $fields = array('create_time', 'start_time', 'done', 'tries', 'message', 'service', 'method', 'discarded', 'result');

    public function getAllNotDone() {
        $sql = "SELECT * FROM {$this->table} WHERE done = 0 AND discarded = 0 AND start_time < NOW() ORDER BY start_time";
        $sth = $this->db->prepare($sql);
        $sth->execute();
        return $sth->fetchAll(PDO::FETCH_ASSOC);
    }
}
